.page-application-category {
  --bg: #fff9f9;
  --title-color: #121212;
  --cat-text: #fff9f9;
  --label-bg: #0267B1;
  --card-w: 424px;
  --card-h: 467px;
  --gap: 22px;
  --row-gap: 52px;
  --label-h: 65px;
  --radius: 8px;
}

/* base */
*{box-sizing:border-box;margin:0;padding:0}
body{background:var(--bg);font-family:'Manrope',sans-serif;color:var(--title-color)}

/* Heading */
.heading{font-family:'Domine',serif;font-weight:700;font-size:40px;color:var(--title-color);text-align:center;padding:20px;margin-bottom:20px}

/* Grid rows (DESKTOP: fixed widths to match original layout) */
.grid {
  display: grid;
  grid-template-columns: repeat(3, var(--card-w));
  gap: var(--gap);
  justify-content: center;
  margin-bottom: var(--row-gap);
  width: 100%;
  max-width: 1400px;
  box-sizing: border-box;
  grid-auto-rows: auto;
  align-items: start; 
}


/* Special class for rows with fewer items — center them */
.grid.two-items {
  display:flex;
  justify-content:center;
  gap: var(--gap);
  margin-bottom: var(--row-gap);
}

/* Card */
.card{
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--radius);
  overflow:hidden;
  position:relative;
  background:#000; /* fallback while image loads; it's covered by img */
  box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}

.card-image{
  width:100%;
  height:100%;
  object-fit:cover;
  transition: transform 350ms ease;
  display:block;
}
.card:hover .card-image{
  transform: scale(1.05);
}

/* Category label (bottom strip) - desktop original behaviour (overlay) */
.category-label{
  position:absolute;
  bottom:0;
  left:0;
  width: var(--card-w);
  height: var(--label-h);
  background: var(--label-bg);
  display:flex;
  align-items:center;
  justify-content:center;
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}
.category-text{
  font-family:'Domine',serif;
  font-weight:700;
  font-size:24px;
  color:var(--cat-text);
  text-align:center;
  padding:20px;
}

/* Pagination - desktop look preserved */
/* Buttons have an inner stroke (inset) of 1px #121212 as requested */
.pagination{display:flex;justify-content:center;gap:22px;margin:40px 0}
.page-btn{
  font-family:'Manrope',sans-serif;
  font-weight:600;
  font-size:20px;
  padding:10px 20px;
  border-radius:8px;
  background:#fff;
  color:#232321;
  cursor:pointer;
  outline:none;
  box-shadow: inset 0 0 0 1px #121212; /* inner stroke */
}
.page-btn.active{
  background:#121212;
  color:#fff;
  box-shadow: inset 0 0 0 1px #121212;
}
.page-btn.inactive{background:#fff;color:#232321}

/* -------------------------------------------------------------
   RESPONSIVE OVERRIDES (tablet + mobile) — preserve desktop above
   ------------------------------------------------------------- */

/* Large laptops / smaller desktops - keep two columns if screen narrower */
@media (max-width: 1400px) {
  .grid {
    grid-template-columns: repeat(2, var(--card-w));
    gap: var(--gap);
    width: calc(2 * var(--card-w) + 1 * var(--gap));
    padding: 0 40px;
    box-sizing: border-box;
  }
}

/* Tablets */
@media (max-width: 991px) {
  .heading { font-size: 36px; padding: 20px 16px; }

  /* make grid responsive - columns stack but keep card width */
  .grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(280px, 1fr));
    gap: 22px;
    width: 100%;
    padding: 0 32px;
    box-sizing: border-box;
    justify-items: center;
  }

  /* two-items row should center its items */
  .grid.two-items {
    display:flex;
    justify-content:center;
    gap: var(--gap);
    padding: 0 32px;
    box-sizing: border-box;
  }

  .card {
    width: 100%;
    max-width: 380px;
    height: auto;
  }

  /* adapt label overlay width to card width */
  .category-label {
    width: 100%;
    left: 0;
  }

  .category-text { font-size: 20px; padding: 16px; }
  .pagination { padding: 0 32px; margin: 40px 0; }
  .page-btn { font-size: 18px; padding: 8px 18px; }
}

/* Mobile portrait */
@media (max-width: 767px) {
  .heading { font-size: 32px; padding: 16px; margin-bottom: 16px; }

  /* single column, full width cards with side padding */
  .grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    width: 100%;
    padding: 0 20px; /* ← mobile side padding fix */
    box-sizing: border-box;
    justify-items: center;
  }

  .grid.two-items {
    display:flex;
    flex-direction:column; /* for mobile keep them stacked (but if you want 2 in row, change to row) */
    gap: 20px;
    padding: 0 20px;
  }

  .card {
    width: 100%;
    max-width: 100%;
    height: auto;
  }

  /* label overlay adapts to full width */
  .category-label {
    position:absolute;
    bottom:0;
    left:0;
    width:100%;
    height:auto;
    padding: 12px;
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
    align-items:center;
    justify-content:center;
  }

  .category-text { font-size: 16px; padding: 0; }
  .pagination { padding: 0 20px; margin: 30px 0; gap: 16px; }
  .page-btn { font-size: 16px; padding: 8px 14px; }
}

/* Small phones */
@media (max-width: 480px) {
  .heading { font-size: 26px; padding: 12px; margin-bottom: 12px; }
  .category-text { font-size: 15px; }
  .page-btn { font-size: 15px; padding: 6px 12px; }
}
